#include "lib_standard.fxh"
#include "lib_procedurals.fxh"
#include "lib_input.fxh"

void Vertex_Shader(float3 position, float3 normal,float3 tangent, float2 uv1, float2 uv2, float2 uv3, float2 uv4,
				  float4 color, float deformation, float4x4 transform, out tPixelShaderInput dataOut) {

	dataOut.position_ws	= mul( float4(position,1), transform);
	dataOut.hposition	= mul( float4(position,1), mul(transform,ViewProj) );
	dataOut.normal		= mul(normal, (float3x3)transform);
	dataOut.tangent		= mul(tangent, (float3x3)transform);
	dataOut.position_os	= position;
	dataOut.uv12.xy		= uv1;
	dataOut.uv12.zw		= uv2;
	dataOut.uv34.xy		= uv3;
	dataOut.uv34.zw		= uv4;
	dataOut.color		= color;
	dataOut.deformation = deformation;
}

void Pixel_Shader(float3 position_os, float3 position_ws, float3 normal,float3 tangnet, float2 uv1, float2 uv2, float2 uv3, float2 uv4,
				  float4 color, float deformation, float pixeldepth, out float4 outColor) {

					  
	float3 lightingDiffuse;
	float3 lightingAmbinet;
	float3 lightingSpecular;

	ComputeLighting(normal, position_ws, dot(normal, (float3)0.33f), 
		lightingDiffuse, lightingSpecular, lightingAmbinet);
	
	outColor.xyz = lightingSpecular + lightingAmbinet + lightingDiffuse * color * 0.2f;
	outColor.w = 1.0f;
}